package com.hnevc.mallserver3.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.hnevc.mallserver3.entity.Member;

import com.hnevc.mallserver3.mapper.MemberMapper;
import com.hnevc.mallserver3.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member login(String memberPhone, String password) {
        return memberMapper.selectMemberByPhoneAndPassword(memberPhone, password);
    }

    @Override
    public Member login2(String username, String password) {
        return memberMapper.selectMemberByUsernameAndPassword(username, password);
    }

    @Override
    public Member updateHeadPic(Integer id, String s) {
        Member one = memberMapper.selectById(id);
        one.setIcon(s);
        if (memberMapper.updateById(one)>0){
            return one;
        }
        return null;
    }

}
